

package main

import (
	"html/template"
	"net/http"
)

// IndexHandler  去首页
func IndexHandler(w http.ResponseWriter, r *http.Request)  {
	//解析模板
	t := template.Must(template.ParseFiles("html/index.html"))
	//执行
	t.Execute(w, "")
}
func main() {
	//设置处理静态资源
	http.Handle("/html/", http.StripPrefix("/html/", http.FileServer(http.Dir("html/"))))
	http.Handle("/time/", http.StripPrefix("/time/", http.FileServer(http.Dir("time/"))))
	http.Handle("/encoding/", http.StripPrefix("/encoding/", http.FileServer(http.Dir("encoding/"))))
	http.Handle("/", http.StripPrefix("/", http.FileServer(http.Dir("./"))))
	//http.HandleFunc("/", IndexHandler)
	http.ListenAndServe(":9200", nil)
}


